
package nccloud.web.arap.payablebill.action;

import com.alibaba.fastjson.JSONObject;

import nc.itf.org.IOrgResourceCodeConst;
import nccloud.framework.web.processor.refgrid.RefQueryInfo;
import nccloud.framework.web.ui.meta.RefMeta;
import nccloud.web.refer.DefaultGridRefAction;

public class PayableitemDefaultGridRefAction extends DefaultGridRefAction {

	public PayableitemDefaultGridRefAction() {
		super();
		setResourceCode(IOrgResourceCodeConst.ORG);
	}

	@Override
	public RefMeta getRefMeta(RefQueryInfo arg0) {
		RefMeta retMeta = new RefMeta();

		retMeta.setCodeField("scomment");
		retMeta.setNameField("scomment");
		retMeta.setPkField("pk_payableitem");
		retMeta.setTableName("ap_payableitem");
		retMeta.setExtraFields(new String[] { "scomment" });
		retMeta.setMutilLangNameRef(false);
		setShowDisabledData(null);
		return retMeta;
	}

	@Override
	public String getOrderSql(RefQueryInfo para, RefMeta meta) {
		return null;
	}

	@Override
	public String getExtraSql(RefQueryInfo para, RefMeta meta) {
		String reslut = para.getQueryCondition().get("crossRuleConditionsVO");
		JSONObject josn = (JSONObject) JSONObject.parseObject(reslut).getJSONObject("model");
		String pk_payablebill = josn.getJSONArray("rows").getJSONObject(0).getJSONObject("values")
				.getJSONObject("ytdcode").getString("value");
		String sql = " pk_payablebill = '" + pk_payablebill + "' and dr=0 and isnull(ljsyje, 0) < local_money_cr";
		return sql;
	}

}
